// pages/index/index.js
Page({
  data: {
    number: 0,
    borders: [],
    position: [
      { value: 'bottom', text: '立即续费' },
    ],
    list:[
      {id:1,text:'首期月付',price:"￥155"},
      {id:2,text:'押金',price:"￥155"},
      {id:3,text:'共计',price:"￥155",color:'#b99946'},
      {id:4,text:'备注',price:"这是备注"}
    ],
    list1:[
      {id:1,text:'咖啡机咖啡机1',price:"待收货",color1:'#dac89d',
      color:'#0e0e0e',size:'1.1rem;',weight:'bold;'},
      {id:2,text:'价格',price:"￥200/月",color:'#cfcfcf'},
      {id:3,text:'押金',price:"￥200",color:'#cfcfcf'},
      {id:4,text:'规格',price:"22期",color:'#cfcfcf'},
      {id:5,text:'数量',price:"1",color:'#cfcfcf'},
    ],
    list2:[
      {id:1,text:'订单编号',text1:'154556565656'},
      {id:2,text:'物流编号',text1:'1662323'},
      {id:3,text:'订单状态',text1:'待收货'},
      {id:4,text:'租赁日期',text1:'2023-12-25至2026-12-25'},
      {id:5,text:'下车续费',text1:'2024-01-01'},
    ],
    list3:[
      {id:1,text:'价格',price:"￥200/月"},
      {id:2,text:'押金',price:"￥200"},
      {id:3,text:'共计',price:"15"}
    ],
  },
  onLoad: function () {
    this.createBorders();
  },
  // 返回上一页
  goInter(){
    wx.navigateBack({
      delta: 1
    })
},
  // 线
  createBorders: function () {
    const borders = [];
    for (let i = 1; i <= 18; i++) {
      const border = {};
      if (i % 2 === 0) {
        border.color = '#d4ddfc';
      } else {
        border.color = '#fbced1';
      }
      borders.push(border);
    }
    this.setData({ borders });
  },
  // 加减
  increaseNumber() {
    this.setData({
      number: this.data.number + 1,
    });
  },

  decreaseNumber() {
    if (this.data.number > 0) {
      this.setData({
        number: this.data.number - 1,
      });
    }
  },
  // popup
  handlePopup(e) {
    const { item } = e.currentTarget.dataset;
    this.setData(
      {
        cur: item,
      },
      () => {
        this.setData({ visible: true });
      },
    );
  },
  onVisibleChange(e) {
    this.setData({
      visible: e.detail.visible,
    });
  },
});
